package com.base.api;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;

/**
 * Controller基类
 * @author 177****0334
 * @date 2020/12/23 09:49
 */
public class BaseController {

    protected Logger log = LoggerFactory.getLogger(this.getClass());

    public static final String sec = "f4k9f5w7f8g4er26";

    @Autowired
    protected HttpServletRequest request;
    /**
     * 判断请求是否为异步
     */
    private boolean isAjax(HttpServletRequest request){
        return StringUtils.isNotBlank(request.getHeader("X-Requested-With"));
    }

    public String getOpenId() {
        return request.getHeader("openId");
    }

}